﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace MailMerge_Generator
{
    public partial class Frm_Config3 : Form
    {
        public Frm_Config3()
        {
            InitializeComponent();
            //Greeting
            txt_Greeting_SpaceAbove.Text = Frm_Main.oLetter.Greeting.SpaceAbove.ToString();
            txt_Greeting_SpaceBelow.Text = Frm_Main.oLetter.Greeting.SpaceBelow.ToString();
            txt_Greeting_LeftIndent.Text = Frm_Main.oLetter.Greeting.LeftIndent.ToString();
            txt_Greeting_FirstLine.Text = Frm_Main.oLetter.Greeting.FirstLine.ToString();
            //Body
            txt_Body_SpaceAbove.Text = Frm_Main.oLetter.Body.SpaceAbove.ToString();
            txt_Body_SpaceBelow.Text = Frm_Main.oLetter.Body.SpaceBelow.ToString();
            txt_Body_LeftIndent.Text = Frm_Main.oLetter.Body.LeftIndent.ToString();
            txt_Body_FirstLine.Text = Frm_Main.oLetter.Body.FirstLine.ToString();
            //Summary
            txt_Summary_SpaceAbove.Text = Frm_Main.oLetter.Summary.SpaceAbove.ToString();
            txt_Summary_SpaceBelow.Text = Frm_Main.oLetter.Summary.SpaceBelow.ToString();
            txt_Summary_LeftIndent.Text = Frm_Main.oLetter.Summary.LeftIndent.ToString();
            txt_Summary_FirstLine.Text = Frm_Main.oLetter.Summary.FirstLine.ToString();
            //Closing
            txt_Closing_SpaceAbove.Text = Frm_Main.oLetter.Closing.SpaceAbove.ToString();
            txt_Closing_SpaceBelow.Text = Frm_Main.oLetter.Closing.SpaceBelow.ToString();
            txt_Closing_LeftIndent.Text = Frm_Main.oLetter.Closing.LeftIndent.ToString();
            txt_Closing_FirstLine.Text = Frm_Main.oLetter.Closing.FirstLine.ToString();
            //Sender
            txt_Sender_SpaceAbove.Text = Frm_Main.oLetter.Sender.SpaceAbove.ToString();
            txt_Sender_SpaceBelow.Text = Frm_Main.oLetter.Sender.SpaceBelow.ToString();
            txt_Sender_LeftIndent.Text = Frm_Main.oLetter.Sender.LeftIndent.ToString();
            txt_Sender_FirstLine.Text = Frm_Main.oLetter.Sender.FirstLine.ToString();
        }
        private void btn_SaveFields_Click(object sender, EventArgs e)
        {
            //Save all fields into the oLetter object
            //Greeting
            Frm_Main.oLetter.Greeting.SpaceAbove = int.Parse(txt_Greeting_SpaceAbove.Text);
            Frm_Main.oLetter.Greeting.SpaceBelow = int.Parse(txt_Greeting_SpaceBelow.Text);
            Frm_Main.oLetter.Greeting.LeftIndent = int.Parse(txt_Greeting_LeftIndent.Text);
            Frm_Main.oLetter.Greeting.FirstLine = int.Parse(txt_Greeting_FirstLine.Text);
            //Body
            Frm_Main.oLetter.Body.SpaceAbove = int.Parse(txt_Body_SpaceAbove.Text);
            Frm_Main.oLetter.Body.SpaceBelow = int.Parse(txt_Body_SpaceBelow.Text);
            Frm_Main.oLetter.Body.LeftIndent = int.Parse(txt_Body_LeftIndent.Text);
            Frm_Main.oLetter.Body.FirstLine = int.Parse(txt_Body_FirstLine.Text);
            //Summary
            Frm_Main.oLetter.Summary.SpaceAbove = int.Parse(txt_Summary_SpaceAbove.Text);
            Frm_Main.oLetter.Summary.SpaceBelow = int.Parse(txt_Summary_SpaceBelow.Text);
            Frm_Main.oLetter.Summary.LeftIndent = int.Parse(txt_Summary_LeftIndent.Text);
            Frm_Main.oLetter.Summary.FirstLine = int.Parse(txt_Summary_FirstLine.Text);
            //Closing
            Frm_Main.oLetter.Closing.SpaceAbove = int.Parse(txt_Closing_SpaceAbove.Text);
            Frm_Main.oLetter.Closing.SpaceBelow = int.Parse(txt_Closing_SpaceBelow.Text);
            Frm_Main.oLetter.Closing.LeftIndent = int.Parse(txt_Closing_LeftIndent.Text);
            Frm_Main.oLetter.Closing.FirstLine = int.Parse(txt_Closing_FirstLine.Text);
            //Sender
            Frm_Main.oLetter.Sender.SpaceAbove = int.Parse(txt_Sender_SpaceAbove.Text);
            Frm_Main.oLetter.Sender.SpaceBelow = int.Parse(txt_Sender_SpaceBelow.Text);
            Frm_Main.oLetter.Sender.LeftIndent = int.Parse(txt_Sender_LeftIndent.Text);
            Frm_Main.oLetter.Sender.FirstLine = int.Parse(txt_Sender_FirstLine.Text);
            Close();
        }
        private void btn_close_Click(object sender, EventArgs e)
        {
            Close();
        }
    }
}
